<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
    <title>按起终点名称规划路线</title>
    <link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>
    <style type="text/css">
        #panel {
            position: fixed;
            background-color: white;
            max-height: 90%;
            overflow-y: auto;
            top: 10px;
            right: 10px;
            width: 280px;
        }
      body,html,#container{
        height: 100%;
        margin: 0px;
        font:12px Arial;
      }
      .taiwan{
      	border: solid 1px red;
      	color: red;
      	float: left;
      	width: 25px;
      	background-color: rgba(255,0,0,0.1)
      }
    </style>
   <script src="https://webapi.amap.com/js/marker.js"></script>
    <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.3&key=2cac86522faa9f85cd8c9154c254625a&plugin=AMap.Walking"></script>
    <script type="text/javascript" src="http://cache.amap.com/lbs/static/addToolbar.js"></script>
</head>
<body>
   <div id="container" tabindex="0"></div>
<script type="text/javascript">
  var map = new AMap.Map('container',{resizeEnable: true,zoom:15});
        var markers = []; //province见Demo引用的JS文件
		var markArr = [
			{name:'点A',location:'116.405285,39.904989',type:0},
			{name:'点A',location:'116.302106,32.551808',type:1}			
		];
        for (var i = 0; i < markArr.length; i += 1) {
    			var marker;
    			if (markArr[i].type === 1) {
    				var icon = new AMap.Icon({
    					image: 'https://vdata.amap.com/icons/b18/1/2.png',
    					size: new AMap.Size(24, 24)
    				});
    				marker = new AMap.Marker({
    					icon: icon,
    					position: markArr[i].location.split(','),
    					offset: new AMap.Pixel(-12,-12),
    					zIndex: 101,
    					title: markArr[i].name,
    					map: map
    				});
    			} 
//  			else {
//  				marker = new AMap.Marker({
//  					position: markArr[i].location.split(','),
//  					title: markArr[i].name,
//  					map: map
//  				});
//		            if (markArr[i].type === 0) {
//		      				var content= "<div class = 'taiwan'>台湾</div>";
//		      				baodao = new AMap.Marker({
//		      					content: content,
//		      					position: markArr[i].location.split(','),
//		      					title: markArr[i].name,
//		      					offset: new AMap.Pixel(0,0),
//		      					map: map
//		      				});
//		            }
//  			}
    			markers.push(marker);
    		}
			  map.setFitView();
</script>
</body>
</html>